package io;

import java.io.BufferedOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class FlushDemo1 {
    public static void main(String[] args) throws IOException {
        FileOutputStream fos  = new FileOutputStream("jinag.txt");
        BufferedOutputStream bos = new BufferedOutputStream(fos);
        Scanner sc = new Scanner(System.in);
        System.out.println("你想要说些什么:");
        String str = sc.next();
        byte[] data = str.getBytes(StandardCharsets.UTF_8);
        bos.write(data);
        bos.flush();
        System.out.println("写出完成");
        bos.close();
    }
}
